package com.example.demo.Work.Consumer;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queuesToDeclare = @Queue(value = "Work_RabbitMq", durable = "true", autoDelete = "false"))
public class Consumer2 {
    /**
     * Handler:处理者
     *
     * @param message
     * @RabbitHandler 注解是指定某方法作为消息消费的方法, 例如监听某Queue 里面的消息。
     */
    @RabbitHandler
    public void HelloConsumer(String message) {
        System.out.println("消费者2消费：" + message);
    }

}
